package day13;
import java.beans.XMLEncoder;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.*;
/**
 * @author oldliu
 * @since 1.0
 */
public class SaveProducts {
    public static void main(String[] args) {
        List<Product> ps=new ArrayList<>();
        ps.add(new Product(1,"核桃仁",55.5,100,false,"河北","袋"));
        ps.add(new Product(2,"荣事达洗衣机",1555.5,3,false,"河北","台"));
        ps.add(new Product(3,"格兰仕微波炉",455.2,22,false,"河北","台"));
        ps.add(new Product(4,"中华牙膏",4.5,2222,false,"河北","袋"));
        ps.add(new Product(5,"波司登羽绒服",1055.5,100,false,"河北","件"));

        try {
            XMLEncoder xe=new XMLEncoder(new FileOutputStream("products.xml"));
            xe.writeObject(ps);
            xe.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
